﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace KALE_Scanning {
    public partial class ChangeFileName : Form {
        string sName = "";
        //girilen ismimde bir dosya var mı diye kontrol gerek
        public ChangeFileName(string _OldFileName) {
            sName = _OldFileName;
            InitializeComponent();
        }

        private void ChangeFileName_Load(object sender, EventArgs e) {
            this.Text = "Dosya ismi değiştirilmeli : " + sName;
            txtNewFileName.Text = sName;
            txtNewFileName.SelectAll();
        }

        private void btnChangeName_Click(object sender, EventArgs e) {
            if(!string.IsNullOrEmpty(txtNewFileName.Text.Trim()))
            {
                Utility.NewFileNameContainer = txtNewFileName.Text.Trim();
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show("İsim boş olamaz!");
                this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                return;
            }
            
        }

        private void formClose()
        {
            this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e) {
            this.formClose();
        }
    }
}
